<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>运单批量导入</title>
		<!-- 导入jquery核心类库 -->
		<script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
		<!-- 导入easyui类库 -->
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/ext/portal.css">
		<link rel="stylesheet" type="text/css" href="../../css/default.css">
		<script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../js/easyui/ext/jquery.portal.js"></script>
		<script type="text/javascript" src="../../js/easyui/ext/jquery.cookie.js"></script>
		<script src="../../js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
		<script type="text/javascript" src="../../js/ocupload/jquery.ocupload-1.1.2.js"></script>
		<script type="text/javascript">
			$(function(){
				$("#grid").datagrid({
					url : '',
					toolbar : [
						{
							id : 'btn-download',
							text : '模板下载',
							iconCls : 'icon-save',
							handler : function(){
								location.href = "../../download.action?filename=工作单导入模板.xls";
							}
						},{
							id : 'btn-upload',
							text : '批量导入',
							iconCls : 'icon-redo'
						},{
							id : 'btn-refresh',
							text : '刷新',
							iconCls : 'icon-reload',
							handler : function(){
								$("#grid").datagrid('reload');						
							}
						}        
					],
					columns : [[
						{
							field : 'id',
							title : '编号',
							width : 120 ,
							align : 'center'
						},{
							field : 'goodsType',
							title : '产品',
							width : 120 ,
							align : 'center'
						},{
							field : 'sendProNum',
							title : '快递产品类型',
							width : 120 ,
							align : 'center'
						},{
							field : 'sendName',
							title : '发件人姓名',
							width : 120 ,
							align : 'center'
						},{
							field : 'sendMobile',
							title : '发件人电话',
							width : 120 ,
							align : 'center'
						},{
							field : 'sendAddress',
							title : '发件人地址',
							width : 120 ,
							align : 'center'
						},{
							field : 'recName',
							title : '收件人姓名',
							width : 120 ,
							align : 'center'
						},{
							field : 'recMobile',
							title : '收件人电话',
							width : 120 ,
							align : 'center'
						},{
							field : 'recCompany',
							title : '收件人公司',
							width : 120 ,
							align : 'center'
						},{
							field : 'recAddress',
							title : '收件人地址',
							width : 120 ,
							align : 'center'
						}
					]],
					pageList: [10,20,30],
					pagination : true,
					striped : true,
					singleSelect: true,
					rownumbers : true,
					fit : true // 占满容器
				});
				
				// 一键上传
				$("#btn-upload").upload({
					 name: 'upload',  // <input name="file" />
				     action: '../../waybill_batchImport.action',  // 提交请求action路径
				     enctype: 'multipart/form-data', // 编码格式
				     autoSubmit: true, // 选中文件提交表单
				     onComplete: function(response) {
				        	if(response=="success"){
				        		$.messager.alert("提示信息","数据导入成功！","info");
				        		$("#grid").datagrid("reload");
				        	}else{
				        		$.messager.alert("错误提示",response,"error");
				        	}
				     }// 请求完成时 调用函数
				});
			});
		</script>
	</head>

	<body class="easyui-layout">
		<div region="center">
			<table id="grid"></table>
		</div>
	</body>
</html>